/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * StatisticPanel.java
 *
 * Created on 2010-9-28, 15:25:07
 */
package dataanalysis.gui.statisticPanel;

import dataanalysis.main.MainView;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import weka.core.Instances;

/**
 *
 * @author Administrator
 */
public class StatisticPanel extends javax.swing.JPanel {

    private final MainView m_manager;
    private final FrequencyPanel m_frequencyPanel = new FrequencyPanel();
    private final DataSpacePanel m_dataSpacePanel = new DataSpacePanel();
    private JPanel m_curPanel = m_frequencyPanel;

    /** Creates new form StatisticPanel */
    public StatisticPanel(MainView manager) {
        m_manager = manager;
        this.setLayout(new BorderLayout());
        this.add(m_frequencyPanel);
    }

    public void setInstances(Instances data) {
        m_frequencyPanel.setInstances(data);
        m_dataSpacePanel.setInstances(data);
    }

    public void showFreqMode() {
        if (m_curPanel == m_frequencyPanel) {
            return;
        }
        this.removeAll();
        this.add(m_frequencyPanel);
        m_curPanel = m_frequencyPanel;
        this.repaint();
        this.validate();
    }

    public void showSpaceMode() {
        if (m_curPanel == m_dataSpacePanel) {
            return;
        }
        this.removeAll();
        this.add(m_dataSpacePanel);
        m_curPanel = m_dataSpacePanel;
        this.repaint();
        this.validate();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
